package TrafficControlSystem.Common;

import java.io.IOException;
import java.io.PrintWriter;
import java.net.Socket;

public class SETINTENSITYRequest extends Request {

	public SETINTENSITYRequest(Socket clientSocket, IntensityInfo intensity) {
		super(clientSocket);
		this.intensity = intensity;
	}

	@Override
	public void send() {
		try {
			PrintWriter writer = new PrintWriter(clientSocket.getOutputStream());
			writer.print("SETINTENSITY\r\n");
			String xml = IntensityInfoSerializer.toXML(intensity);
			writer.println(xml.length());
			writer.print(xml);
			writer.flush();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	private IntensityInfo intensity;
}
